﻿
// Condition: 7. Write a method that reverses the digits of given decimal number. Example: 256 - 652


using System;

class ReverseDecimalNumber
{
    static string revString(decimal decNumber)
    {
        // convert decimal to string
        string numString = Convert.ToString(decNumber);
        string revString = null;

        // for each elements of the string write digit in new string in reverse order 
        for (int i = numString.Length-1; i >= 0; i--)
        {
            if (numString[i] == '.' || numString[i]==',')
            {
                continue;
            }

            revString += numString[i];
        }
        return revString;

    }


    static void Main(string[] args)
    {
        // enter decimal number
        Console.Write("Enter decimal number: ");
        decimal n = Convert.ToDecimal(Console.ReadLine());
        string reverse = revString(n);


        // print reverse number
        Console.WriteLine();
        Console.WriteLine("The digits of given decimal in reverse order are: {0}",reverse);

    }
}

